﻿<%@ Page Title="Media Management - Video Uploading" Language="C#" MasterPageFile="~/admin.master"
    AutoEventWireup="true" Inherits="MediaMonitor.Admin.Media_Mgmt_AddEdit"
    Theme="default" CodeBehind="media-mgmt-addedit.aspx.cs" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Head" runat="Server">
    <script type="text/javascript">
        function ShowHideDiv(div, show) {
            if (show) {
                div.style.display = 'block';
                document.getElementById('dvUpload').style.display = 'none';
            }
            else {
                div.style.display = 'none';
                document.getElementById('dvUpload').style.display = 'block';
            }

        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Body" runat="Server">
    <div style="text-align:right; width:90%;">
        <a class="BigLink Bold" href="media-mgmt-list.aspx">List of Videos</a>
    </div>
    <asp:UpdatePanel ID="pnlUpdate" runat="server">
        <ContentTemplate>
            <table cellspacing="10">
                <tr>
                    <th>
                        Select Advertiser
                    </th>
                    <td>
                        <asp:DropDownList DataSourceID="sqlDSAdv" ID="lstAdvertiser" AutoPostBack="true"
                            runat="server" DataTextField="AdvertiserName" DataValueField="AdvertiserCode"
                            ValidationGroup="form" OnSelectedIndexChanged="lstAdvertiser_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="rfvAdvertiser" runat="server" ControlToValidate="lstAdvertiser"
                            ErrorMessage="Advertiser required" Text="*" Display="Dynamic" ValidationGroup="form"
                            InitialValue="" />
                    </td>
                </tr>
                <tr>
                    <th>
                        Select Brand
                    </th>
                    <td>
                        <asp:DropDownList DataSourceID="sqlDSBrand" ID="lstBrand" AutoPostBack="true" runat="server"
                            DataTextField="BrandName" DataValueField="BrandCode" ValidationGroup="form" OnSelectedIndexChanged="lstBrand_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="rfvBrand" runat="server" ControlToValidate="lstBrand"
                            ErrorMessage="Brand required" Text="*" Display="Dynamic" ValidationGroup="form"
                            InitialValue="" />
                    </td>
                </tr>
                <tr>
                    <th>
                        Select Product
                    </th>
                    <td>
                        <asp:DropDownList DataSourceID="sqlDSProd" ID="lstProduct" AutoPostBack="true" runat="server"
                            DataTextField="ProductName" DataValueField="ProductCode" ValidationGroup="form"
                            OnSelectedIndexChanged="lstProduct_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="rfvProduct" runat="server" ControlToValidate="lstProduct"
                            ErrorMessage="Product required" Text="*" Display="Dynamic" ValidationGroup="form"
                            InitialValue="" />
                    </td>
                </tr>
                <tr>
                    <th>
                        Select Product Version
                    </th>
                    <td>
                        <asp:DropDownList DataSourceID="sqlDSVersion" ID="lstVersion" AutoPostBack="true"
                            runat="server" DataTextField="ProdVersionName" DataValueField="ProdVersionCode"
                            ValidationGroup="form" OnSelectedIndexChanged="lstVersion_SelectedIndexChanged">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="rfvVersion" runat="server" ControlToValidate="lstVersion"
                            ErrorMessage="Version required" Text="*" Display="Dynamic" ValidationGroup="form"
                            InitialValue="" />
                    </td>
                </tr>

               
            </table>
        
 
            <br />
            <br />
            <div id="dvUpload">
                <table class="Box Highlight">
                    <tr>
                        <td>
                            Select full Video:
                        </td>
                        <td>
                            <%-- <telerik:RadUpload ID="flVideo" runat="server"  AllowedFileExtensions="wmv"
                    OverwriteExistingFiles="true" ControlObjectsVisibility="None" MaxFileSize="50000" RegisterWithScriptManager="true" ViewStateMode="Enabled"  > </telerik:RadUpload>--%>
                            <asp:FileUpload ID="flVideo" runat="server" />
                          
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Select Preview Video:
                        </td>
                        <td>
                            <%--<telerik:RadUpload ID="flVideo_Short" runat="server" OverwriteExistingFiles="true"
                    ControlObjectsVisibility="None" MaxFileSize="500">
                    
                </telerik:RadUpload>--%>
                            <asp:FileUpload ID="flVideo_Short" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <br />
                            <asp:Button ID="btnUpload" runat="server" ValidationGroup="form" Text="Upload" OnClick="btnUpload_Click"
                                OnClientClick="javascript:ShowHideDiv(document.getElementById('dvUploading'), true)" />
                            <br />
                            <asp:Label ID="lblMsg" runat="server" SkinID="Error" />
                        </td>
                    </tr>
                </table>
            </div>
            <div id="dvUploading" class="GrayBox" style="display: none; text-align: center; width: 300px;"
                align="center">
                <h3>
                    Uploading Data...</h3>
            </div>
            <br />
 
 
        </ContentTemplate>
        <Triggers>
            <asp:PostBackTrigger ControlID="btnUpload" />
        </Triggers>
    </asp:UpdatePanel>
 
    <asp:SqlDataSource ID="sqlDSAdv" runat="server" ConnectionString="<%$ ConnectionStrings:DBAdex%>"
                SelectCommand="SELECT * FROM Advertiser ORDER BY AdvertiserName"></asp:SqlDataSource>

            <asp:SqlDataSource ID="sqlDSBrand" runat="server" ConnectionString="<%$ ConnectionStrings:DBAdex%>"
                SelectCommand="SELECT * FROM Brand WHERE AdvertiserCode = @AdvertiserCode ORDER BY BrandName">
                <SelectParameters>
                    <asp:ControlParameter ControlID="lstAdvertiser" DefaultValue="0" ConvertEmptyStringToNull="true"
                        Name="AdvertiserCode" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="sqlDSProd" runat="server" ConnectionString="<%$ ConnectionStrings:DBAdex%>"
                SelectCommand="SELECT * FROM Product WHERE BrandCode = @BrandCode ORDER BY ProductName">
                <SelectParameters>
                    <asp:ControlParameter ControlID="lstBrand" DefaultValue="0" ConvertEmptyStringToNull="true"
                        Name="BrandCode" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="sqlDSVersion" runat="server" ConnectionString="<%$ ConnectionStrings:DBAdex%>"
                SelectCommand="SELECT * FROM ProdVersion WHERE ProductCode = @ProductCode ORDER BY ProdVersionName">
                <SelectParameters>
                    <asp:ControlParameter ControlID="lstProduct" DefaultValue="0" ConvertEmptyStringToNull="true"
                        Name="ProductCode" Type="Int32" />
                </SelectParameters>
            </asp:SqlDataSource>


  
</asp:Content>
